package com.hmyd.hmyd_android.dialog;

import com.hmyd.hmyd_android.R;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;

public class IdentifyingDialog extends Dialog implements
		android.view.View.OnClickListener {

	private View mClosed;
	private EditText amount;
	private Button ok;

	private IdentifyingDialogListener mOnclickListener;
	
	public IdentifyingDialog(Context context) {
		super(context);
		requestWindowFeature(Window.FEATURE_NO_TITLE);

	}

	public IdentifyingDialog(Context context, int theme,IdentifyingDialogListener onclickListener) {
		super(context, theme);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		mOnclickListener = onclickListener;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_identifying);

		mClosed = findViewById(R.id.closed);
		mClosed.setOnClickListener(this);
		
		amount = (EditText) findViewById(R.id.amount);
		
		ok = (Button) findViewById(R.id.ok);
		ok.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.closed:
			cancel();
			break;
		case R.id.ok:
			
			if(!TextUtils.isEmpty(amount.getText().toString().trim())){
				mOnclickListener.getIdentifyind(amount.getText().toString().trim());
				cancel();
			}
			
			break;
		default:
			break;
		}

	}

}
